/***************************************************************************//**
 * @file Simulation.h
 * @author  Marek M. Cel <marekcel@mscsim.org>
 *
 * @section LICENSE
 *
 * Copyright (C) 2014 Marek M. Cel
 *
 * This file is part of MScSim. You can redistribute and modify it under
 * the terms of GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Further information about the GNU General Public License can also be found
 * on the world wide web at http://www.gnu.org.
 ******************************************************************************/
#ifndef SIMULATION_H
#define SIMULATION_H

////////////////////////////////////////////////////////////////////////////////

#include <QObject>

#include <FDM/FDM_Thread.h>
#include <GUI/MainWindow.h>
#include <HID/HID_Thread.h>

////////////////////////////////////////////////////////////////////////////////

/** Main simulation class. */
class Simulation : public QObject
{
    Q_OBJECT

public:

    /** Constructor. */
    Simulation( QObject *parent = 0 );

    /** Destructor. */
    virtual ~Simulation();

    /** */
    void init();

protected:

    /** */
    void timerEvent( QTimerEvent *event );

private:

    int m_timerId;

    FDM_Thread *m_fdm;
    HID_Thread *m_hid;

    MainWindow *m_win;

    FDM_DataInp m_fdmDataInp;
    FDM_DataOut m_fdmDataOut;

    GUI_DataInp m_guiDataInp;
    GUI_DataOut m_guiDataOut;

    /** Using this constructor is forbidden. */
    Simulation( const Simulation & ) : QObject( 0 ) {}

    /** */
    void dataToFDM();

    /** */
    void dataToGUI();
};

////////////////////////////////////////////////////////////////////////////////

#endif // SIMULATION_H
